<template>
  <div class="graph-relation-toolbar">
    <div
      class="u-item"
      v-show="screenDirection === 'normalScreen'"
      @click="changeFullScreen('fullScreen')"
    >
      <el-icon class="u-icon">
        <FullScreen />
      </el-icon>
      <div class="u-label">全屏</div>
    </div>
    <div
      class="u-item"
      v-show="screenDirection === 'fullScreen'"
      @click="changeFullScreen('normalScreen')"
    >
      <el-icon class="u-icon">
        <FullScreen />
      </el-icon>
      <div class="u-label">还原</div>
    </div>
    <div
      class="u-item"
      @click="$emit('clickZoomOut')"
      @mouseenter="zoomOutActived = true"
      @mouseleave="zoomOutActived = false"
    >
      <el-icon class="u-icon">
        <CirclePlus />
      </el-icon>
      <div class="u-label">放大</div>
    </div>
    <div
      class="u-item"
      @click="$emit('clickZoomIn')"
      @mouseenter="zoomInActived = true"
      @mouseleave="zoomInActived = false"
    >
      <el-icon class="u-icon">
        <Remove />
      </el-icon>
      <div class="u-label">缩小</div>
    </div>
  </div>
</template>

<script setup name="GraphRelationToolbar">
import { ref } from 'vue'

const emit = defineEmits(['changeFullScreen'])

const screenDirection = ref('normalScreen') // fullScreen normalScreen
const zoomInActived = ref(false)
const zoomOutActived = ref(false)

function changeFullScreen(d) {
  screenDirection.value = d
  emit('changeFullScreen', screenDirection.value)
}
</script>

<style lang="stylus" scoped>
.graph-relation-toolbar
  padding 13px 0
  width 42px
  border-radius 42px
  // border 1px solid #eee
  background #fff
  .u-item
    padding 8px 0
    text-align center
    color #616998
    cursor pointer
    &:hover
      color #2970F6
  .u-icon
    margin 0 auto
    width 20px
    height 20px
    font-size 20px
    img
      width 100%
      height 100%
  .u-label
    margin-top 6px
    font-size 12px
</style>
